package com.rocky.component.util.serializer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.rocky.component.util.constant.Formatter;

import java.io.IOException;
import java.time.LocalDate;

/**
 * @author rocky
 * date 2025-08-09
 * Description:
 */
public class DateDeserializer extends JsonDeserializer<LocalDate> {
    @Override
    public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return LocalDate.parse(p.getText().trim(), Formatter.DATE_FORMATTER);
    }
}
